package com.cyurs.netty.nio;

import java.nio.Buffer;
import java.nio.ByteBuffer;

/**
 * @Author: Cyrus
 * @CreateDate: 2020/11/16
 */
public class BufferTypeDemo {
    public static void main(String[] args) {
        ByteBuffer buffer = ByteBuffer.allocate(64);

        buffer.putInt(1);
        buffer.putChar('a');
        buffer.putLong(1);
        buffer.putShort((short) 1);

        buffer.flip();

        System.out.println(buffer.getInt());
        System.out.println(buffer.getChar());
        System.out.println(buffer.getLong());
        System.out.println(buffer.getShort());
    }
}
